package com.huawei.hwCloudJs.d;

import android.content.Context;
import android.util.Log;
import java.lang.reflect.Field;

public class e {
    private static final String a = "ReflectUtils";

    public enum a {
        RES_TYPE_ID("id"),
        RES_TYPE_LAYOUT("layout"),
        RES_TYPE_STRING("string"),
        RES_TYPE_DRAWABLE("drawable"),
        RES_TYPE_STYLE("style"),
        RES_TYPE_COLOR("color"),
        RES_TYPE_DIMEN("dimen"),
        RES_TYPE_MENU("menu"),
        RES_TYPE_ARRAY("array");
        
        private String j;

        private a(String str) {
            this.j = str;
        }

        public String toString() {
            return this.j;
        }
    }

    public static final int a(Context context, a aVar, String str) {
        try {
            Field field = Class.forName(context.getPackageName() + ".R$" + aVar.toString()).getField(str);
            return Integer.parseInt(field.get(field.getName()).toString());
        } catch (ClassNotFoundException e) {
            Log.e(a, "reflect ClassNotFoundException! resourceType=" + aVar + "--resourceName=" + str);
            return 0;
        } catch (IllegalAccessException e2) {
            Log.e(a, "reflect ClassNotFoundException! resourceType=" + aVar + "--resourceName=" + str);
            return 0;
        } catch (NoSuchFieldException e3) {
            Log.e(a, "reflect ClassNotFoundException! resourceType=" + aVar + "--resourceName=" + str);
            return 0;
        }
    }

    public static final int a(Context context, String str) {
        return a(context, a.RES_TYPE_ID, str);
    }

    public static final int b(Context context, String str) {
        return a(context, a.RES_TYPE_STRING, str);
    }

    public static final int c(Context context, String str) {
        return a(context, a.RES_TYPE_LAYOUT, str);
    }

    public static final int d(Context context, String str) {
        return a(context, a.RES_TYPE_STYLE, str);
    }

    public static final int e(Context context, String str) {
        return a(context, a.RES_TYPE_COLOR, str);
    }

    public static final int f(Context context, String str) {
        return a(context, a.RES_TYPE_DRAWABLE, str);
    }

    public static final int g(Context context, String str) {
        return a(context, a.RES_TYPE_DIMEN, str);
    }

    public static final int h(Context context, String str) {
        return a(context, a.RES_TYPE_MENU, str);
    }

    public static final int i(Context context, String str) {
        return a(context, a.RES_TYPE_ARRAY, str);
    }
}
